/**
 * Copyright &copy; 2012-2016 <a href="https://git.oschina.net/zdw2016/webbase5">Webbase</a> All rights reserved.
 */
package com.foreveross.webbase.projectdemo.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.foreveross.webbase.common.service.CrudService;
import com.foreveross.webbase.projectdemo.entity.Servertype;
import com.foreveross.webbase.projectdemo.service.ServerServertypeService;
import com.foreveross.webbase.projectdemo.service.ServertypeService;
import com.foreveross.webbase.projectdemo.dao.ServertypeDao;

/**
 * 服务器类型管理Service
 * @author yangwanli
 * @version 2017-03-15
 */
@Service
public class ServertypeServiceImpl extends CrudService<ServertypeDao, Servertype> implements ServertypeService {
	
	@Autowired
	private ServerServertypeService serverServertypeService;
	/**
	 * 删除数据
	 * @param id
	 */
	@Override
	@Transactional(readOnly = false)
	public void delete(String id) {
		dao.delete(id);
		serverServertypeService.deleteTypeid(id);
	}
	/**
	 * 获取单条数据
	 * @param type
	 * @return
	 */
	public Servertype getName(String type){
		return dao.getName(type);
	}
	
	/**
	 * 删除数据
	 * @param entity
	 */
	@Override
	@Transactional(readOnly = false)
	public void delete(Servertype servertype) {
		dao.delete(servertype);
		serverServertypeService.deleteTypeid(servertype.getId());
	}
}